
import func from './vue-temp/vue-editor-bridge';
<template>
    <div class="newsinfo-container">
        <h3 class="title">{{newsinfo.title}}</h3>
        <p class="subtitle">
            <span>发表时间：{{newsinfo.add_time | dateFormat}}</span>
            <span>点击量：{{newsinfo.click}}</span>
        </p>
        <hr>
        <div class="content" v-html="newsinfo.content">
        </div>
        <newsinfo-comp :id="this.id"></newsinfo-comp>
    </div>
</template>

<script>
    
    import  comment from '../subcomponents/comment.vue'

    export default {
        data () {
           return {
                id : $route.params.id,   // 将URL地址中传递过来的Id值挂载到data上，方便以后调用
                newsinfo: {}  // 新闻对象
           }
        },
        created () {
            this. getNewsInfo () 
        },
        methods : {
            getNewsInfo () {
                this.$http.get('api/getnew/'+id).then((result) => {
                    if (result.body.status === 0) {
                        this.newsinfo = result.body.message
                    }
                })
            }
        },
        components:{
            'newsinfo-comp' : comment
        }
    }
</script>

<style lang="scss">
   .newsinfo-container {
       padding: 0 10px;
       .title{
           font-size: 16px;
           color: red;
           text-align: center;
           margin: 15px 0;
       }
       .subtitle{
           font-size: 12px;
           color: #22aff2;
           display: flex;
           justify-content: space-between;
       }
       .content{

           img{
               width: 100%;
           }

       }
   }
</style>
